﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using HR60_PanelSoft.Model;
using HR60_PanelSoft.Model.BaseModel;
using HR60_PanelSoft.Service;
using HR60_PanelSoft.View;
using HR60_PanelSoft.View.TabForms;
using HR60_PanelSoft.View.Controls;
using System.Runtime.InteropServices;


namespace HR60_PanelSoft.View
{
    //GC: [g1]执行业务约束[WindowMain]@s2
    //GC: [g2]业务层约束——名称查重[WindowMain]@s2
    //GC: [g3]加载bug[WindowMain]

    //GC: [g4]名称修改不能反射到树[WindowMain]
    //GC: [g5]面板删除逻辑增加智能终端逻辑[WindowMain]
    //GC: [g6]联调[WindowMain]
    //GC: [g7]控制台嵌入Winform[WindowMain](放弃)
    //GC: [g8]联调-增加spliter
    //GC: [g9]优化：未保存提醒[WindowMain]
    //GC: [g10]联调7-24-2：新需求，网关设置更改到网关扫描位置[WindowMain]
    //GC: [g11]bug2185/2186/2187[WindowMain]
    //GC: [g12]bug2192/2194/2203/2204/2205[WindowMain]
    //GC: [g13]bug2604/2609[WindowMain]
    //GC: [g14]NewReq，编辑菜单页


	public partial class WindowMain : Form
	{

        /* [g8.s2]增加尺寸 */
        private int _pnl_min_height = 1;
        private int _pnl_normal_height = 200;
        /* end of [g8.s2] */
        [DllImport("kernel32.dll")]
        static extern bool FreeConsole();

        [DllImport("kernel32.dll")]
        static extern bool AllocConsole();

		public WindowMain()
		{
			InitializeComponent();

			// 界面特性
			this.Font = new Font ("宋体", 10);
			this.mainMenuStrip.Font = new Font ("宋体", 10);
            /* [g7.s1] 设置控制台界面 */
            //this.SPLC_ONSPLC1PNL1_HOLD.SplitterDistance = this.SPLC_ONSPLC1PNL1_HOLD.Height + 20;
            //this.TSMI_ONVIEW_CONSOLE.Text = "显示控制台";
            //_console = new Utils.ConsoleForm("C:\\Windows\\System32\\cmd.exe", this.RTBOX_ONSPLC2PNL2_CONSOLE);
            
            //_console = new Utils.ConsoleForm(Application.ExecutablePath, this.RTBOX_ONSPLC2PNL2_CONSOLE);
            /* end of [g7.s1] */

            /* [g8.s1] */
            this.PNL_ONMAIN_HOLDBOTTOM.Height = _pnl_min_height;//隐藏
            /* end of [g8.s1] */
			// 测试数据
			//initProj (ProjService.createDemo ());

            /* [g13.s8] */

            projTree.BeforeSelect += new TreeViewCancelEventHandler(projTree_BeforeSelecte);
            /* end of [g13.s8] */
		}

		WindowPublic windowPublic = new WindowPublic();
        /* [g10.s1] */
		//WindowSetting windowSetting = new WindowSetting();
        /* end of [g10.s1] */
		AboutBox aboutBox = new AboutBox();

        /* [g7.s3] 增加控制台对象 */
        //HR60_PanelSoft.View.Utils.ConsoleForm _console = null;

        /* end of [g7.s3] */

		Proj proj = null;
		TreeNode projNode { get {return projTree.Nodes [0];} }
		TreeNode groupListNode { get {return projNode.Nodes [0];} }
		TreeNode netListNode { get {return projNode.Nodes [1];} }
		TreeNode sceneListNode { get {return projNode.Nodes [2];} }
		
		/// <summary>
		/// 初始化界面
		/// </summary>
		/// <param name="proj">Proj.</param>
		public void initProj(Proj proj)
		{
			this.proj = proj;
			projTree.Nodes.Clear();
			
			// 项目名称
			projTree.Nodes.Add (proj.name);
			projNode.Nodes.Add ("设备列表");
			projNode.Nodes.Add ("网络列表");
			projNode.Nodes.Add ("场景列表");

			// 设备
			foreach (DeviceGroup group in proj.deviceGroups)
			{
				addDeviceGroup (group);
				foreach (Device device in group.devices)
					addDevice (group, device);
			}

			// 网络,面板
			foreach (HR60_PanelSoft.Model.Net net in proj.nets) 
			{
				addNet (net);
				foreach (HR60_PanelSoft.Model.Panel panel in net.panels)
					addPanel (net, panel);
			}

			// 场景
			foreach (Scene scene in proj.scenes) 
				addScene (scene);

			// 右键菜单
			ProjTreeNodeMenu projTreeMenu = new ProjTreeNodeMenu();
			projTreeMenu.bindProjTree(projTree);

			// 默认显示项目编辑页
			showProjEdit (proj);
			projNode.Expand ();
			groupListNode.Expand ();
			netListNode.Expand ();
			sceneListNode.Expand ();

		}

		////////////////////////////////////////////////////////////////////////////
		///							ProjTree 相关操作
		////////////////////////////////////////////////////////////////////////////

		#region ProjTree 相关操作

		public TreeNode addDeviceGroup(DeviceGroup group)
		{
			TreeNode node = groupListNode.Nodes.Add (group.uuid, group.name);
			node.Tag = group;
			return node;
		}

		public TreeNode removeDeviceGroup(DeviceGroup group)
		{
			return removeProjTreeNode (group.uuid);
		}

		public TreeNode addDevice(DeviceGroup group, Device device)
		{
			TreeNode pnode = findProjTreeNode (group.uuid);
			if (pnode == null) return null;

			TreeNode node = pnode.Nodes.Add (device.uuid, device.nickName);
			node.Tag = device;
			return node;
		}

		public TreeNode removeDevice(Device device)
		{
			return removeProjTreeNode (device.uuid);
		}

		public TreeNode addNet(HR60_PanelSoft.Model.Net net)
		{
			TreeNode node = netListNode.Nodes.Add (net.uuid, net.name);
			node.Tag = net;
			return node;
		}

		public TreeNode removeNet(HR60_PanelSoft.Model.Net net)
		{
			return removeProjTreeNode (net.uuid);
		}

		public TreeNode addPanel(HR60_PanelSoft.Model.Net net, HR60_PanelSoft.Model.Panel panel)
		{
			TreeNode pnode = findProjTreeNode (net.uuid);
			if (pnode == null) return null;

			TreeNode node = pnode.Nodes.Add (panel.uuid, panel.name);
			node.Tag = panel;
			return node;
		}

		public TreeNode removePanel(HR60_PanelSoft.Model.Panel panel)
		{
			return removeProjTreeNode (panel.uuid);
		}

		public TreeNode addScene(Scene scene)
		{
			TreeNode node = sceneListNode.Nodes.Add (scene.uuid, scene.name);
			node.Tag = scene;
			return node;
		}

		public TreeNode removeScene(Scene scene)
		{
			return removeProjTreeNode (scene.uuid);
		}

		private TreeNode removeProjTreeNode(string key)
		{
			TreeNode node = findProjTreeNode (key);
			if (node != null) node.Remove ();
			return node;
		}

		private TreeNode findProjTreeNode(string key)
		{
			TreeNode[] nodes = projTree.Nodes.Find (key, true);
			if (nodes.Length > 0)
			{
				return nodes [0];
			}
			else
			{
				return null;
			}
		}

		private TreeNode findProjTreeNodeByTag(object value)
		{
			return findProjTreeNodeByTag(projNode, value);
		}

		private TreeNode findProjTreeNodeByTag(TreeNode parentNode, object value)
		{
			foreach (TreeNode node in parentNode.Nodes)
			{
				if (node.Tag != null && node.Tag.Equals(value))
				{
					return node;
				}
				else
				{
					TreeNode tag = findProjTreeNodeByTag(node, value);
					if (tag != null) return tag;
				}
			}
			return null;
		}


		#endregion

		////////////////////////////////////////////////////////////////////////////
		///							TabPage 相关操作
		////////////////////////////////////////////////////////////////////////////

		#region TabPage 相关操作

		private IDictionary<string, object> createBindData()
		{
			IDictionary<string, object> map = new Dictionary<string, object>();
			return map;
		}

		public void showProjEdit(Proj proj)
		{
            hideAllPage();
			mainTabs.TabPages.Add(pageProj);

			IDictionary<string, object> map = createBindData();
			pageProjForm.refreshForm(map);
		}

		public void showGroupEdit(DeviceGroup group)
		{
            hideAllPage();
            mainTabs.TabPages.Add(pageGroup);

			IDictionary<string, object> map = createBindData();
			map.Add("group", group);
			pageGroupForm.refreshForm(map);
		}

		public void showDeviceEdit(Device device)
		{
            hideAllPage();
            mainTabs.TabPages.Add(pageDevice);

			IDictionary<string, object> map = createBindData();
			map.Add("device", device);
			pageDeviceForm.refreshForm(map);
		}

		public void showNetEdit(HR60_PanelSoft.Model.Net net)
		{
            hideAllPage();
            mainTabs.TabPages.Add(pageNet);

			IDictionary<string, object> map = createBindData();
			map.Add("net", net);
			pageNetForm.refreshForm(map);
		}

        //GC: 负载编辑不能提交到内存对象，进而不能保存至json
        /*
         * 
         * 
         *          
         */
		public void showPanelEdit(HR60_PanelSoft.Model.Panel panel)
		{
            hideAllPage();
			IDictionary<string, object> map = createBindData(); 
			map.Add("panel", panel);

            mainTabs.TabPages.Add(pagePanel);
			pagePanelForm.refreshForm(map);

			if (panel.type.maxPage > 0 || panel.type.maxScenePage > 0)
			{
				mainTabs.TabPages.Add(pageButton);
				pagePanelButtonForm.refreshForm(map);
			}
			if (panel.type.hasExPage)
			{
				mainTabs.TabPages.Add(pageEx);
				pagePanelExForm.refreshForm(map);
			}
			if (panel.type.hasSignalModel)
			{
				mainTabs.TabPages.Add(pageSignal);
				pagePanelSignalForm.refreshForm(map);
			}
		}

		public void showSceneEdit(Scene scene)
		{
            /* [g14.s1]  */
            //取消旧逻辑
            //IDictionary<string, object> map = createBindData();
            //map.Add("scene", scene);
            //hideAllPage();
            //mainTabs.TabPages.Add(pageScene);
            //sceneForm.refreshForm(map);

            hideAllPage();
            mainTabs.TabPages.Add(pageNewScn);
            SCNTAB_ONSCN_SCN.refresh(scene);
            
            /* end of [g14.s1] */
		}

        /* [g7.s4]设置控制台窗口属性 */

        private void setConsoleForm(bool toBeVisible)
        {
            if (toBeVisible)
            {
                //this.PNL_ONMAIN_HOLDBOTTOM.Height = _pnl_normal_height;
                TSMI_ONVIEW_CONSOLE.Text = "隐藏控制台";
            }
            else
            {
                //this.PNL_ONMAIN_HOLDBOTTOM.Height = _pnl_min_height;
                TSMI_ONVIEW_CONSOLE.Text = "显示控制台";
            }
        }
        /* end of [g7.s4] */

        public void hideAllPage()
        {
            mainTabs.TabPages.Clear();
        }

		#endregion

		////////////////////////////////////////////////////////////////////////////
		///							控制层代码
		////////////////////////////////////////////////////////////////////////////

		#region 控制层代码

		// 新建项目
		public void doCreateNewProj()
		{
			ProjService.createNew();
			initProj(ProjService.getCurrentProj());
		}

		// 打开项目文件
		public void doOpenProj()
		{
			string path = ViewUtils.showOpenFileDialog();
			if (path != null)
			{
				try
				{
					ProjService.load(path);
				}
				catch(Exception ee)
				{
					ViewUtils.showError("项目文件载入失败,请检查项目文件路径是否正确." + "\r\n" + ee.ToString());
				}
				initProj(ProjService.getCurrentProj());
			}
		}

		// 保存项目文件
		public void doSaveProjFile()
		{
			if (ProjService.getCurrentProjFilePath() == null)
			{
				doSaveProjFileAs();
				return;
			}
			ProjService.saveFile();
		}

		// 另存项目文件
		public void doSaveProjFileAs()
		{
			string path = ViewUtils.showSaveFileDialog();
			if (path != null)
			{
				try
				{
					ProjService.saveFileAs(path);
				}
				catch
				{
					ViewUtils.showError("项目文件保存失败,请检查路径是否正确.");
				}
				initProj(ProjService.getCurrentProj());
			}
		}

		// 保存项目信息
		public void doSaveProj(IDictionary<string, object> form)
		{
			Proj dto = new Proj();
			dto.name = (string) form["name"];
			dto.writer = (string) form["writer"];
			dto.addr = (string) form["addr"];
			dto.defaultStyle = (UIStyle) form["defaultStyle"];

            /* [g3.s1] */
			//dto.date = DateTime.Parse(form["date"].ToString());
            dto.date = form["date"].ToString();
            /* end of [g3.s1] */
			ProjService.save(dto);

			projNode.Text = dto.name;
		}

		// 保存设备分组
		public void doSaveDeviceGroup(DeviceGroup source, IDictionary<string, object> form)
		{
			DeviceGroup dto = new DeviceGroup();
			dto.name = (string) form["name"];
			DeviceGroupService.save(source, dto);

			findProjTreeNodeByTag(source).Text = dto.name;
		}

		// 删除设备分组
		public void doRemoveDeviceGroup(DeviceGroup group)
		{
            /* [g13.s1]bug2604，设备组防提示 */
            if (DialogResult.Cancel == MessageBox.Show("确定继续进行删除操作？", "提示", MessageBoxButtons.OKCancel))
                return;
            /* end of [g13.s1] */

			DeviceGroupService.remove(group);
			removeDeviceGroup(group);
		}

		// 添加设备分组
		public void doCreateNewDeviceGroup()
		{
			DeviceGroup group = new DeviceGroup();
			group.name = "新建分组";
			DeviceGroupService.append(group);
			projTree.SelectedNode = addDeviceGroup(group);
		}

		// 保存设备
		public void doSaveDevice(Device source, IDictionary<string, object> form)
		{
			Device dto = new Device();
			dto.nickName = (string) form["nickName"];
            if (source.type.brands.Count > 0)
                /* [g12.s1]brand根据name保存 */
                //dto.brand = (DeviceBrand) form["brand"];
                dto.brand = source.type.brands.Find(new Predicate<DeviceBrand>((x)=>
                    {
                        return x.name == form["brand"];
                    }));
                /* end of [g12.s1] */
			if (source.type.subDeviceType != null)
			{
				IList<object> subNickNames = (IList<object>)form["subNickNames"];
				for(int i=0; i<subNickNames.Count; i++)
				{
					Device subDto = new Device();
					subDto.nickName = (string) subNickNames[i];
					dto.childDevices.Add(subDto);
				}
			}
			DeviceService.save(source, dto);
			findProjTreeNodeByTag(source).Text = dto.nickName;
		}

		// 删除设备
		public void doRemoveDevice(Device device)
		{
            /* [g13.s2]bug2604，设备防删提示 */
            if (DialogResult.Cancel == MessageBox.Show("确定继续进行删除操作？", "提示", MessageBoxButtons.OKCancel))
                return;
            /* end of [g13.s2] */

			DeviceService.remove(device);
			removeDevice(device);
		}

		// 添加新设备
		public void doCreateNewDevice(IDictionary<string, object> form)
		{
			DeviceType type = (DeviceType)form["type"];
			DeviceGroup group = (DeviceGroup)projTree.SelectedNode.Tag;
			Device device = DeviceService.append(type, group);
            /* [g1.s3] 进行Device约束性检查 */
            if (DeviceService.RestrictErr)
                return;
            /* end of [g1.s3] */

			projTree.SelectedNode = addDevice(group, device);
		}

		// 添加子设备
		public Device doAddNewSubDevice(Device parentDevice)
		{
			return DeviceService.appendNewSub(parentDevice);
		}

		// 移除子设备
        /* [g11.s1]将删除状态返回 */
		//public void doRemoveSubDevice(Device parentDevice, Device subDevice)
        public bool doRemoveSubDevice(Device parentDevice, Device subDevice)
        /* end of [g11.s1] */
		{
            /* [g13.s3]bug2604，子设备防删提示 */
            if (DialogResult.Cancel == MessageBox.Show("确定继续进行删除操作？", "提示", MessageBoxButtons.OKCancel))
                return false;
            /* end of [g13.s3] */

			return DeviceService.removeSub(parentDevice, subDevice);
		}


		// 保存网络
		public void doSaveNet(HR60_PanelSoft.Model.Net source, IDictionary<string, object> form)
		{
			HR60_PanelSoft.Model.Net dto = new HR60_PanelSoft.Model.Net();
			dto.name = (string) form["name"];
			dto.index = Int32.Parse(form["index"].ToString());
			NetService.save(source, dto);

			findProjTreeNodeByTag(source).Text = dto.name;
		}

		// 删除网络
		public void doRemoveNet(HR60_PanelSoft.Model.Net net)
		{
            /* [g13.s4]bug2604，网络防删提示 */
            if (DialogResult.Cancel == MessageBox.Show("确定继续进行删除操作？", "提示", MessageBoxButtons.OKCancel))
                return;
            /* end of [g13.s4] */

			NetService.remove(net);
			removeNet(net);
		}

		// 添加网络
		public void doCreateNewNet()
		{
			HR60_PanelSoft.Model.Net net = new HR60_PanelSoft.Model.Net();
			/* [g2.s1] Net防止重名 */
            //net.name = "新建网络";
            net.name = "网络" + NetService.NameSerialNo.ToString();
            /* end of [g2.s1] */
			net.index = NetService.newNetId();
			NetService.append(net);
            /* [g1.s1] 进行Net约束性检查 */
            if (NetService.RestrictErr)
            {
                return;
            }
            /* end of [g1.s1] */
			projTree.SelectedNode = addNet(net);
		}

        /* [g4.s1] */
		// 保存面板
		public void doSavePanel(HR60_PanelSoft.Model.Panel source, IDictionary<string, object> form)
		{

            HR60_PanelSoft.Model.Panel dto = new HR60_PanelSoft.Model.Panel();
            dto = source;
            dto.name = (string)form["name"];
            dto.style = (UIStyle)form["style"];
            dto.eplusType = (EplusType)form["eplus"];
            dto.index = Int32.Parse(form["index"].ToString());

            PanelService.save(source, dto);

            projTree.SelectedNode.Text = dto.name;

		}

        public void doSavePanel(string name)
        {
            projTree.SelectedNode.Text = name;
        }


        /* end of [g4.s1] */

		// 删除面板
		public void doRemovePanel(HR60_PanelSoft.Model.Panel panel)
		{

            /* [g13.s5]bug2604，面板防提示 */
            if (DialogResult.Cancel == MessageBox.Show("确定继续进行删除操作？", "提示", MessageBoxButtons.OKCancel))
                return;
            /* end of [g13.s5] */

            /* [g5.s1] 增加面板删除失败的判断 */
            //PanelService.remove(panel);
            //removePanel(panel);

            if (PanelService.remove(panel))
                removePanel(panel);
            /* end of [g5.s1] */
		}

		// 添加新设备
		public void doCreateNewPanel(IDictionary<string, object> form)
		{
			PanelType type = (PanelType)form["type"];
			HR60_PanelSoft.Model.Net net = (HR60_PanelSoft.Model.Net)projTree.SelectedNode.Tag;
			HR60_PanelSoft.Model.Panel panel = PanelService.append(type, net);

            /* [g1.s2] 进行Panel约束性检查 */
            if (PanelService.RestrictErr)
            {
                return;
            }
            /* end of [g1.s2] */
			projTree.SelectedNode = addPanel(net, panel);
		}


		// 保存场景
        /* [g4.s2] */
		public void doSaveScene(Scene source, Scene dto)
		{
            projTree.SelectedNode.Text = source.name;

		}

        /* end of [g4.s2] */

		// 删除场景
		public void doRemoveScene(HR60_PanelSoft.Model.Scene scene)
		{
            /* [g13.s6]bug2604，场景防删提示 */
            if (DialogResult.Cancel == MessageBox.Show("确定继续进行删除操作？", "提示", MessageBoxButtons.OKCancel))
                return;
            /* end of [g13.s6] */

			SceneService.remove(scene);
			removeScene(scene);
		}

		// 添加网络
		public void doCreateNewScene()
		{
			Scene scene = new Scene();
            /* [g2.s2]场景防重名 */
			//scene.name = "新建场景";
            scene.name = "场景" + SceneService.NameSerialNo.ToString();
            /* end of [g2.s2] */
			SceneService.append(scene);
			projTree.SelectedNode = addScene(scene);
		}

		#endregion

		////////////////////////////////////////////////////////////////////////////
		///							控件事件
		////////////////////////////////////////////////////////////////////////////

		#region ProjTree事件

		// TreeNode选择事件
		private void projTree_AfterSelect(object sender, TreeViewEventArgs e)
		{
			TreeNode node = projTree.SelectedNode;
			object tag = node.Tag;
			if (node == projNode)
			{
				showProjEdit(proj);
			}
			else if (tag == null)
			{
				showProjEdit(proj);
			}
			else if (tag.GetType() == typeof(DeviceGroup))
			{
				showGroupEdit((DeviceGroup)tag);
			}
			else if (tag.GetType() == typeof(Device))
			{
				showDeviceEdit((Device)tag);
			}
			else if (tag.GetType() == typeof(HR60_PanelSoft.Model.Net))
			{
				showNetEdit((HR60_PanelSoft.Model.Net)tag);
			}
			else if (tag.GetType() == typeof(HR60_PanelSoft.Model.Panel))
			{
				showPanelEdit((HR60_PanelSoft.Model.Panel)tag);
			}
			else if (tag.GetType() == typeof(Scene))
			{
				showSceneEdit((Scene)tag);
			}
			projTree.Focus ();
            if (projTree.SelectedNode != null)
            {
                projTree.SelectedNode.BackColor = SystemColors.Highlight;
                projTree.SelectedNode.ForeColor = Color.White;
            }

		}

		#endregion

		#region 主菜单事件

		private void 新建项目ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			doCreateNewProj();
		}

		private void 读取ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			doOpenProj();
		}

		private void 保存ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			doSaveProjFile();
		}

		private void 另存为ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			//doSaveProjFile();//GC: bug
            doSaveProjFileAs();
		}

		private void 退出ToolStripMenuItem1_Click(object sender, EventArgs e)
		{
			Application.Exit();
		}


		private void 发布ToolStripMenuItem_Click(object sender, EventArgs e)
		{
            /* [g6.s1]鲁棒 */
            if (proj == null)
            {
                View.ViewUtils.showAlert("请先创建项目！");
                return;
            }
            /* end of [g6.s1] */
			windowPublic.ShowDialog(this);
		}

		private void 使用帮助ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			ViewUtils.showMessage("暂不提供此功能");
		}

		private void 关于ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			aboutBox.ShowDialog(this);
		}

		#endregion


        /* [g7.s2]显示控制台菜单事件 */
        private void TSMI_ONVIEW_CONSOLE_Click(object sender, EventArgs e)
        {
            bool isVisible = TSMI_ONVIEW_CONSOLE.Text == "隐藏控制台";
            //if (isVisible)
            //{
            //    _console.Close();
            //    setConsoleForm(false);
            //}
            //else
            //{
            //    _console.Start(RTBOX_ONSPLC2PNL2_CONSOLE);
            //    setConsoleForm(true);
            //}

            /* [g9.s2] */


            if (isVisible)
            {
                FreeConsole();
                setConsoleForm(false);
            }
            else
            {
                AllocConsole();
                setConsoleForm(true);
            }

            /* end of [g9.s2] */

        }

        /* [g9.s1]截获程序退出事件 */
        private void WindowMain_FormClosing(object sender, FormClosingEventArgs e)
        {
            DialogResult dr = MessageBox.Show("程序即将关闭，是否停止退出？", "提示", MessageBoxButtons.YesNoCancel);
            if (dr == DialogResult.Yes || dr == DialogResult.Cancel)
            {
                e.Cancel = true;
            }

        }
        /* end of [g9.s1] */

        /* end of [g7.s2] */

        /* [g13.s7]bug2609 */
        private void projTree_BeforeSelecte(object sender, TreeViewCancelEventArgs e)
        {
            if (projTree.SelectedNode != null)
            {
                projTree.SelectedNode.BackColor = projTree.BackColor;
                projTree.SelectedNode.ForeColor = projTree.ForeColor;
            }
        }

        //private void panel1_Paint(object sender, PaintEventArgs e)
        //{

        //}

        private void PNL_ONMAIN_HOLDBOTTOM_Paint(object sender, PaintEventArgs e)
        {

        }
        /* end of [g13.s7] */


	}
}
